﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using CommunitySystem.Ctrls;
using CommunitySystem.DiaoDongService;
using CommunitySystem.Views;

namespace CommunitySystem
{
    public partial class DiaoDong_DiaoChuBenQuControl : AsyncCtrl, IReturnListenerc
    {
        #region IReturnListenerc 成员

        public void BeginReturn()
        {
        }

        #endregion
        private DiaoDongService.DiaoDongServiceClient client1 = new DiaoDongService.DiaoDongServiceClient();
        public DiaoDong_DiaoChuBenQuControl()
        {
            InitializeComponent();
            client1.GetDiaoDongCompleted += new EventHandler<DiaoDongService.GetDiaoDongCompletedEventArgs>(client1_GetDiaoDongCompleted);
            client1.GetDiaoDongAsync("0", 0,"调出本区","","");
        }


        void client1_GetDiaoDongCompleted(object sender, DiaoDongService.GetDiaoDongCompletedEventArgs e)
        {
            DGRole.ItemsSource = null;
            if (e.Result != null && e.Result.Count > 0)
            {
                for (int i = 0; i < e.Result.Count; i++)
                {
                    e.Result[i].Sec = i + 1;
                    if (e.Result[i].RZQMSJ == null && Convert.ToDateTime(e.Result[i].RZQMSJ) == Convert.ToDateTime("1900-01-01")) e.Result[i].RZQMSJ = null;
                }
                DGRole.ItemsSource = e.Result;


            }
        }
        private void ImageButton_Click(object sender, RoutedEventArgs e)
        {
            var seljw = this.DGRole.SelectedItem as DiaoDongModel;
            if (seljw == null)
            {
                SilverlightMessageBoxLibrary.Message.ErrorMessage("只能选择一个人员进行查看！");
                return;
            }
            OtherEmpInfo view = new OtherEmpInfo(seljw.EmpbasicID,"在职");
            Nav.ShowNextPage(seljw.Name + "-详细信息", view, this);
        }
    }
}
